package com.ruoyi.service.impl;


import com.github.pagehelper.PageHelper;
import com.ruoyi.mapper.MaterielOneMapper;
import com.ruoyi.domain.MaterielOne;
import com.ruoyi.service.MaterielOneService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


@Service
public class MaterielOneServiceImpl implements MaterielOneService {
    @Autowired
    private MaterielOneMapper materielOneMapper;


    @Override
    public Map<String, Object> allMaterielOne(int page, int limit)  {
        List<MaterielOne> materielOnes = materielOneMapper.selectAll();
        PageHelper.startPage(page,limit);
        Map<String, Object> result = new HashMap<>();
        result.put("total",materielOnes.size());
        result.put("data", materielOneMapper.selectAll());
        return result;
    }

    @Override
    public Map<String, Object> selectMaterielOne(int page, int limit, String lotCode1, String itemCode, String lotCode, String docDate){
        List<MaterielOne> materielOnes = materielOneMapper.selectMaterielOne(lotCode1,itemCode,lotCode,docDate);
        PageHelper.startPage(page,limit);
        Map<String, Object> result = new HashMap<>();
        result.put("total", materielOnes.size());
        result.put("data", materielOneMapper.selectMaterielOne(lotCode1,itemCode,lotCode,docDate));
        return result;
    }
}
